
#include <QtGui/QtGui>
#include <QtCore/QtCore>

#include "DPGraphicsView.h"
#include "DPGraphicsItem.h"
#include "DPGraphicsScene.h"
#ifdef Q_OS_SYMBIAN
#include <coemain.h>
#include <aknappui.h>
#endif

#ifdef Q_OS_SYMBIAN
void setPortraitMode()
{
    CAknAppUi *aknAppUi = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
    if (aknAppUi)
        aknAppUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
}

void setLandscapeMode()
{
    CAknAppUi *aknAppUi = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
    if (aknAppUi)
        aknAppUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
}
#endif

int main( int argc, char ** argv)
{

    QApplication qapp(argc, argv);

    Q_INIT_RESOURCE(ResImage);

#ifdef Q_OS_SYMBIAN
    setLandscapeMode();
#endif
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));
    QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK"));

    DPGraphicsScene scene;

    DPGraphicsView view(&scene);
    scene.setSceneRect(view.rect());

//     QRadialGradient gradient(view.size().width()/2, view.size().height()/2,
//                              view.size().height()/2,
//                              view.size().width()/2, view.size().height()/2);
//     gradient.setColorAt(1, QColor::fromRgbF(0, 0, 0, 1));
//     gradient.setColorAt(0, QColor::fromRgbF(1, 0, 0, 0.5));

	view.setAutoFillBackground(true);
        QBrush brush(QPixmap(":/backGround1.jpg"));
	QPalette palette;
	palette.setBrush(view.backgroundRole(), brush);
	view.setPalette(palette);

    //view.setBackgroundBrush(brush);
    view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scene.initGameLogic(":/DPSetting.ini");

    view.show();
	view.showMainMenu(true);

    return qapp.exec();
}
